Normalizing data for fast superscalar processing

ABSTRACT

A data normalization system is described herein that represents multiple data types that are common within database systems in a normalized form that can be processed uniformly to achieve faster processing of data on superscalar CPU architectures. The data normalization system includes changes to internal data representations of a database system as well as functional processing changes that leverage normalized internal data representations for a high density of independently executable CPU instructions. Because most data in a database is small, a majority of data can be represented by the normalized format. Thus, the data normalization system allows for fast superscalar processing in a database system in a variety of common cases, while maintaining compatibility with existing data sets.

BACKGROUND

Superscalar central processing units (CPUs) that can execute more thanone instruction per clock cycle are becoming more and more common forcomputing systems. Unlike pipelined architectures, superscalararchitectures include multiple, redundant functional units that canoperate on many instructions in parallel. Superscalar architecture andpipelining can be used together to provide even more CPU efficiency.Superscalar processing depends in part on the processor being providedwith (or detecting on its own) instruction streams that areintrinsically parallel, meaning that the stream contains operations thatoperate on independent sets of data or in a way that order of executionbetween the operations will not lead to different results. This allowsthe processor to perform multiple operations at the same time.

Most database systems were implemented before superscalar CPUs startedto dominate the market. Superscalar CPUs process data faster providedthere are enough independent instructions inside small instructionwindows (e.g., on the order of up to ˜100 instructions). In such cases,superscalar processors can detect enough independent operations toutilize multiple available CPU execution units. Independent operationsare those with no data or control flow dependencies between them.Database systems often rely on optimizations that are no longerefficient for superscalar architectures. For example, a databaseimplementation may include long functions with many conditionalbranches.

To take advantage of superscalar CPUs, databases need to improve datawarehouse processing to achieve higher efficiency in processing for amajority of data warehouse specific data values. Current internal datarepresentations do not lend themselves to efficient scalar processing.Database systems provide many data types, such as integers, strings,floats, binary blobs, and so forth that may each include a differenttype of internal data structure or other representation. Some of theseare more appropriate for superscalar processing than others. Code pathshave to be constructed with care to ensure very efficient processing andhigh density of independent CPU instructions, which often is not thecase for database systems being used on superscalar processors. Variousspecialized data warehouse engines have been built to take advantage ofsuperscalar CPUs, such as Monet DB/X100 and Microsoft Analysis Services.However, these engines are not generic relational database managementsystem (RDBMS) engines and provide advantages only in limited situationsthat do not address superscalar issues with the database system core.

SUMMARY

A data normalization system is described herein that represents multipledata types that are common within database systems in a normalized formthat can be processed uniformly to achieve faster processing of data onsuperscalar CPU architectures. The data normalization system includeschanges to internal data representations of a database system as well asfunctional processing changes that leverage normalized internal datarepresentations for a high density of independently executable CPUinstructions. Because most data in a database is small, a majority ofdata can be represented by the normalized format. The system includesfunctions that optimistically attempt to handle all data in a batch asnormalized, and to do so compactly with few control flow dependencies.During fast processing, the algorithm identifies data that is notnormalized and sets that data aside for later processing by atraditional, slower algorithm that may not be as superscalar-efficient.Thus, the data normalization system allows for fast superscalarprocessing in a database system in a variety of common cases, whilemaintaining compatibility with existing data sets.

This Summary is provided to introduce a selection of concepts in asimplified form that are further described below in the DetailedDescription. This Summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used to limit the scope of the claimed subject matter.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram that illustrates components of the datanormalization system, in one embodiment.

FIG. 2 is a flow diagram that illustrates processing of the datanormalization system to normalize stored data in an in-memoryrepresentation, in one embodiment.

FIG. 3 is a flow diagram that illustrates processing of the datanormalization system to perform an operation on a tabular set of datahaving rows and columns, in one embodiment.

FIG. 4 is a block diagram that illustrates data values stored using thenormalized representation described herein, in one embodiment.

DETAILED DESCRIPTION

A data normalization system is described herein that represents multipledata types that are common within database systems in a normalized formthat can be processed uniformly to achieve faster processing of data onsuperscalar CPU architectures. The data normalization system includeschanges to internal data representations of a database system as well asfunctional processing changes that leverage normalized internal datarepresentations for a high density of independently executable CPUinstructions. In some embodiments, the system stores data using a 64-bitbinary value that can either represent a normalized data type or act asa pointer to a non-normalized data type for those data types that do notfit the normalization scheme. For example, 64-bits may be insufficientfor storing some types of data, like a long string or a long binaryblob. In some embodiments, a bit of the 64-bit binary value is reservedto indicate whether the value represents a normalized data type or not(e.g., the significant bit can be used for this purpose so that a simpleCPU shift instruction can be used to extract data from the remaining 63bits). Once all data is represented in a common format, it is easier toprovide functional processing that operates on such data in asuperscalar-efficient manner. Because most data in a database is smallerthan the size of the 64-bit data value (e.g., a street number, phonenumber, amount of sales in a region, and so forth), a majority of datacan be represented by the normalized format.

The system includes functions that optimistically attempt to handle alldata in a batch as normalized, and to do so in compact ways (e.g., atight loop) with few control flow dependencies. For example, for a batchof column data having a column each from two sources to be addedtogether, the system may optimistically assume that all of the data inthe columns fits into the normalized scheme described herein, andprocess the data using a fast algorithm that allows each row value inthe columns to be added independently within the CPU. For hundreds ofrows of data this can result in a dramatic execution speed improvement.During fast processing, the algorithm identifies data that is notnormalized (e.g., using the bit described above), and sets that dataaside (e.g., by ignoring it or placing it on a separate list) for laterprocessing by a traditional, slower algorithm that may not be assuperscalar-efficient. For example, the system can make two passesthrough a set of column data, one to perform operations for those rowsthat contain normalized data that can be handled quickly and another toperform operations for those rows that contain non-normalized data thatis processed in a traditional manner. Thus, the data normalizationsystem allows for fast superscalar processing in a database system in avariety of common cases, while maintaining compatibility with existingdata sets.

In some embodiments, the data normalization system establishes aconvention for representing NULL data values in the data set. Fordatabase systems, a NULL value is a different value than a numeric zero,and thus may not be able to be represented in the normalized format inthe same way that zero is. Because the normalized format contains a bitfor indicating non-normalized data, the system can use setting thenon-normalized bit in combination with a null value for the portion thatwould normally point to the non-normalized data as an indication ofNULL. This allows the system to cover a much broader set of commonvalues (NULL) within the normalized format.

In some embodiments, the data normalization system includes hash joinand hash aggregation algorithms that reduce a number of CPU instructionsneeded to perform their task. These algorithms may also minimize dataand control flow dependencies for a majority of data processing toefficiently utilize superscalar CPU resources. These processingtechniques are described further herein.

Superscalar CPUs are able to execute multiple instructions in single CPUcycle provided: a) each instruction performs a simple scalarcalculation, and b) there are no data dependencies in a set ofoperations processed by the CPU in a cycle. The data representationdescribed herein satisfies the first condition for a majority of datavalues so that processing can occur using as few CPU instructions aspossible. Most modern CPUs can perform a variety of native operations on64-bit values. The data normalization system satisfies the secondcondition by improving data processing algorithms so that the CPU hassufficient number of independent operations to perform in closeproximity in a particular code path. In data warehouse scenarios, if anarray of data is to be processed then usually each array element'sprocessing is independent from other elements. The system overlapsprocessing of one array element with processing of one or many otherarray elements to provide multiple independent instructions for thesuperscalar CPU to execute. The system overlaps processing in part bymaking array-processing loops very short so that the CPU can easilyrecognize the parallelism. In these cases, a set of CPU instructionsprocessed in a CPU cycle will include instructions from individual loopiterations. Alternatively, the system overlaps processing by mergingdata processing tasks of two or more separate loop iterations into asingle instruction stream.

In some embodiments described herein, the data normalization system usesa 64-bit or 8-byte value to represent common data types. A 64-bit valueis currently a good choice because most data types will fit in 64 bits(e.g., integers, dates, floats, short strings, Booleans, and so forth).Widely available processors also are natively able to process 64-bitvalues from registers or memory in a single instruction. However, thoseof ordinary skill in the art will recognize that it has been the natureof computing to utilize more space over time, and the system hereincould be easily extended to use a value that includes more than 64 bits(e.g., 128 bits). Conversely, there may also be situations where usingsmaller values would be useful, such as mobile or embedded scenarioswhere memory is constrained, and the system can be adapted to use asmaller number of bits (e.g., 32-bit). The 64-bit value is used hereinas an example, but is not intended to limit the system described to anyparticular bit or byte size implementation.

In the 64-bit example, the data normalization system provides a datarepresentation for NULL and common integer, numeric, and string datatype values in a RDBMS. This particular representation uses eight bytes,where the least significant bit (LSB) is zero to indicate that the valueis of a common type (i.e., frequently used) and can be processed usingthe fast techniques described herein. Another bit could also be used(e.g., the most significant bit), and those of ordinary skill in the artwill recognize that endian-ness of the system and other considerationscan affect the bit chosen. In addition, the system can also use valuesthat do not encode an indication of whether the value is a normalizedtype within the value itself. In the present example, the remaining 63bits represent the value itself (e.g., a number for a numeric value, orseveral characters for a short string value). Such common values can beprocessed very efficiently to meet the first condition descried in theprevious paragraph. If the least significant bit is one and the rest ofbits are zero then it indicates a relational NULL value. If the leastsignificant bit is one and any other bit is non-zero, then the remaining63 bits represent a pointer or other reference (e.g., an index) to anuncommon data type domain value. The system processes non-normalizeddata outside of tight processing loops so as not to interfere withsuperscalar CPU specific optimizations. Note that in many cases, such assum and comparison operations, the system can ignore the leastsignificant bit and perform the operation without shifting thenormalized value to remove the bit. Rather, the system may only need toshift the value at the end of processing to convert data back fromnormalized into native representation.

One example of a common database data type that can be represented usingthis format is the big integer (bigint) provided by Microsoft SQLServer. The bigint data type in Microsoft SQL Server covers range ofinteger values [−2̂64 . . . 2̂64−1]. The system can represent all but theextreme values within the 63 bits available in the normalized datarepresentation. A majority of user data fits into this range. For othervalues, the system uses a conventional representation for bigint values(i.e., for very large positive and very small negative values). Anotherexample is a column containing a varchar(10) data type, which is astring value having a limit of 10 characters. Where string column datais likely to only hold a small set of values (e.g., two letterabbreviations or full names of U.S. states), databases often use adictionary approach where the database stores a dictionary of all of thestring values and stores an index in the column data that points to theappropriate location to find the string in the dictionary. The datanormalization system uses the normalized data representation wheneverstrings reside in the column store dictionary and can be identifiedusing a 63-bit integer index. The system may reserve several bits in thenormalized value to identify a dictionary (there may be more than one)and then the rest of the bits identify a string within the dictionary.Otherwise, the system uses a conventional representation with a pointerpointing to the actual string value. The system can also include stringdata directly in the 63-bits when the string data is sufficiently short(e.g., less than four or eight characters depending on whether ANSI orUNICODE encoding is used).

In these two examples data value comparisons for the normalizedrepresentation for aggregation purposes can be performed using just oneCPU instruction and can fit into a small instruction window thatleverages superscalar CPU processing. Whether the data type is varcharor bigint, the same function can compare the data by directly comparingthe 64-bit integer value. However if involved values are conventional(non-normalized) then comparison can be performed using slowerconventional processing. The data normalization system assembles datainto arrays called batches and processes batches using either smallloops or merged loop iterations. This leverages abilities of superscalarCPUs and increases data processing performance. At the same time, thesystem detects any small subset of data that has conventionalrepresentation or involves complex data processing (like arithmeticerror handling). The system performs this more complex data processingas a separate post-processing step outside of the main processing loop.This processing step may be slower and may not fully leverage abilitiesof the superscalar CPU. However, slow processing of a small subset ofdata will not affect overall performance significantly.

One example is a hash join. In a hash join whenever a join is performedon a normalized key value and a hash table bucket has the only onepotential match, the system can use a tight CPU instruction loop toperform the join. If one of these conditions is not met, then the systemdoes not perform more complex handling immediately, as that mightinterfere with superscalar CPU optimizations. Rather, the systemidentifies rows that do not meet fast processing conditions andprocesses that data later using a post-processing step. Similarly,during hash aggregation in a first pass the system computes results ifall involved values have normalized representation. If at least oneaggregation key or intermediate result is not in normalizedrepresentation or if the system identifies other problematic conditions(such as a potential for arithmetic overflow in calculations), then thesystem postpones row processing for a slower second processing step.However, a majority of data is processed very quickly using the firstprocessing step that is able to leverage the strengths of thesuperscalar CPU.

Common operations in data warehouse processing include operations suchas: copy column (for example from user table into hash table), comparecolumn value for “group by” or join purposes, hash column value, computesum of column values. These operations work much faster if performedover a single fixed-size data type (e.g., 64-bit integers). Mostdatabase systems support many scalar data types, and each data type hasits own implementation of comparison, sum, and copy operations.Sometimes these type-specific implementations are complex (e.g., adding2 high-precision numeric values may take >100 CPU instructions). Adding64-bit integers takes just one CPU instruction on modern CPUs. Thesystem treats all normalized values described herein as integers forcopying, sum, and comparison purposes.

The extra bit check imposed by the implementation described is lowoverhead because a database system includes similar checks for NULLvalues already. In addition, in most cases values will be represented asnormalized, so the extra bit check has a predictable outcome (improvingCPU pipeline utilization). Some functional processing of the datanormalization system can avoid the bit check at runtime if all valuesprocessed in given a part of a query plan are known to be normalized.

As an example, suppose a column data type is numeric (20,2) (total 20digits precision, 2 digits after decimal point). The value 10.01 can berepresented as 1001 normalized integer value. Value999999999999999999.99, however, cannot be represented using normalizedform (because it does not fit into a 64-bit integer) and for thosevalues, the system can fall back to a slow code path to process thosevalues. Fortunately, such large values are very rare. If the systemreceives a request to add two numeric (20,2) columns then the type ofthe result is numeric (21,2). The system can add two normalized valuesusing one instruction (or potentially slightly more to check foroverflow) and the result is still normalized. The system can alsomultiply integer values, and the result will be still normalized withoutany need to perform division because type derivation adjusts the decimalpoint location to numeric (38,4). Other types can be handled similarly,such as strings (described previously), integers (int), financial values(e.g., smallmoney), dates (e.g., datetime), and certain ranges offloating point numbers (e.g., float). Unlike previous in-memory databasetechniques that normalize based on storage format, the datanormalization system normalizes based on type derivation (i.e., makingall types or many types fit within a common representation).

FIG. 1 is a block diagram that illustrates components of the datanormalization system, in one embodiment. The system 100 includes a datastorage component 110, a data normalization component 120, an operationmanager 130, a batch assembly component 140, an outlier identificationcomponent 150, a fast operation component 160, a slow operationcomponent 170, and a result-processing component 180. Each of thesecomponents is described in further detail herein.

The data storage component 110 stores database data persistently betweensessions of use of the system 100. The data storage component 110 mayinclude one or more files, file systems, hard drives, storage areanetworks (SANs), cloud-based storage services, or any other facility forpersisting data. The system 100 may be implemented within a previouslyexisting database core, such as Microsoft SQL Server, or as an add-on ornew type of data processing facility.

The data normalization component 120 retrieves data stored by the datastorage component 110 and loads the retrieved data into memory in anormalized data representation that allows fast superscalar processing.The normalized data representation includes a common format (such as afixed size value) for storing multiple data types, so that processing ofnormalized data can be handled in a unified manner for a variety of datatypes. The uniformity of data also increases potential parallelism whenexecuting on massively parallel or superscalar CPUs. The datanormalization component 120 also provides an in-memory representation ofdata that is not normalized, by providing a normalized value thatincludes a pointer to a data structure for storing non-normalizedvalues. Although this may incur a slightly higher use of memory, thesystem 100 benefits from the unified processing of data of varioustypes. The data normalization component 120 may select an appropriatenormalized representation for each data type based on a type of thedata, a number of values of the data that fall within a normalizablerange, a level of precision of the data, a length of string data, and soforth.

The operation manager 130 manages requests to perform databaseoperations on stored database data. For example, the operation manager130 may include a query engine that receives queries from users orapplications, develops a query plan, executes the query against anin-memory or loaded data set, and provides results back to therequestor. The operation manager 130 invokes the other components of thesystem 100 to perform queries and other operations in a manner thatleverages available hardware, such as superscalar CPUs, efficiently.

The batch assembly component 140 identifies batches of data that havecontrol flow and data independence such that the batch includes multipleinstances of parallelizable operations. For example, the batch assemblycomponent 140 may scan an array of data values and identify whether thedata values include a majority or other threshold of values representedin the normalized data representation described herein. The batchassembly component 140 may also separate data into groups such that eachgroup can minimize control flow interruptions (e.g., branches orexcessive conditional checking) and perform multiple operationsefficiently on a superscalar CPU or set of CPUs.

The outlier identification component 150 identifies data values in abatch of data that cannot be performed by a fast processing path thatperforms efficient superscalar processing. The outlier identificationcomponent 150 can be implemented in a variety of ways, from managing asecond pass through the batch of data after a first fast pass hascompleted, to separating outlying data into a separate data structure,such as a list of remaining data to be post-processed. The outlieridentification component 150 may traverse an array of data and identifyvalues in the array that are not represented in the normalized datarepresentation. The component 150 may place those values on a queue forpost processing or flag the values in place for later processing. Insome embodiments, the outlier identification component 150 and fastoperation component 160 are merged into a single component that performsa fast first pass and detects outlying data at the same time. In suchcases, the component sets the non-normalized data aside for slowerpost-processing.

The fast operation component 160 provides instructions to a superscalarprocessor in a manner that allows parallel execution of the instructionsby multiple functional units of the superscalar processor. For example,the fast operation component 160 may include functions for adding,comparing, or performing other operations on data in a tight loop orwith multiple independent loop operations executable in each loopiteration (or a combination of these). The fast operation component 160may include separate functions or a conditional branch within a functionthat take the fast processing path for data that is represented in thenormalized data format. Because the majority of data types and valuesare represented in the normalized data format, the system 100 achievesfaster execution of common database operations by using the fastoperation component 160 in a majority of operation processing.

The slow operation component 170 performs database operations on datawithin a batch that is not stored in the normalized data representation.The slow operation component 170 is less concerned with fast superscalarexecution and performs the additional processing for handling data typesthat are not handled in a unified manner. For example, the component 170may process data that is expected to include arithmetic overflow, datathat is large or of a nonstandard type, and so forth. The slow operationcomponent 170 implements the type of processing of traditional databaseengines that did not leverage superscalar processing techniques likethose described herein.

The result processing component 180 gathers results from the fastoperation component 160 and slow operation component 170 and returns theresults to an operation requestor. The results processing component 180handles any merging of data from fast and slow paths and any cleanup orother management needed after execution of the fast or slow path. Thecomponent 180 packages the results into an appropriate response format(e.g., a query response or other format), and sends the response to therequestor. Where iterators are used within the database engine, fast andslow operation results may be merged many times in each iterator. Thenext iterator (next operation) receives uniform merged data and splitsthe data again (if applicable) into slow and fast processing, and thenmerges results at the end so that data is ready to be consumed byusers/servers or a subsequent operation. The requestor may includeservers, applications, or users interacting with the system 100 over anetwork or from the same machine on which the system 100 executes. Theresult-processing component 180 provides result responses using anapplication programming interface (API) or protocol through which thesystem 100 received the request.

The computing device on which the data normalization system isimplemented may include a central processing unit, memory, input devices(e.g., keyboard and pointing devices), output devices (e.g., displaydevices), and storage devices (e.g., disk drives or other non-volatilestorage media). The memory and storage devices are computer-readablestorage media that may be encoded with computer-executable instructions(e.g., software) that implement or enable the system. In addition, thedata structures and message structures may be stored or transmitted viaa data transmission medium, such as a signal on a communication link.Various communication links may be used, such as the Internet, a localarea network, a wide area network, a point-to-point dial-up connection,a cell phone network, and so on.

Embodiments of the system may be implemented in various operatingenvironments that include personal computers, server computers, handheldor laptop devices, multiprocessor systems, microprocessor-based systems,programmable consumer electronics, digital cameras, network PCs,minicomputers, mainframe computers, distributed computing environmentsthat include any of the above systems or devices, and so on. Thecomputer systems may be cell phones, personal digital assistants, smartphones, personal computers, programmable consumer electronics, digitalcameras, and so on.

The system may be described in the general context ofcomputer-executable instructions, such as program modules, executed byone or more computers or other devices. Generally, program modulesinclude routines, programs, objects, components, data structures, and soon that perform particular tasks or implement particular abstract datatypes. Typically, the functionality of the program modules may becombined or distributed as desired in various embodiments.

FIG. 2 is a flow diagram that illustrates processing of the datanormalization system to normalize stored data in an in-memoryrepresentation, in one embodiment. Beginning in block 210, the systemaccesses stored data that includes multiple columns, each column havinga data type. For example, the stored data may include file-basedrepresentation of a database, including tables with columns and rows ofdata. Continuing in block 220, the system selects the first column inthe accessed data to determine an appropriate in-memory representation.For example, the stored data may include a list of columns for eachtable, and the system selects the first column for initial processing.On subsequent iterations, the system selects the next column until thereare no more columns.

Continuing in block 230, the system determines a data type of theselected column. For example, the stored data may include columnmetadata that identifies a type of the column data declared by adatabase designer (e.g., bigint, varchar(20), and so forth). The systemidentifies the column type and any other information that may affectwhether the column's row data can be stored in the normalized format(e.g., level of precision, limits on data length, and so forth).Continuing in decision block 240, if the system can normalize thedetermined column data type, then the system continues at block 250,else the system continues at block 260. The system may store a list oftypes that the system can normalize or other criteria such as a lengthlimit for particular types that can be normalized. In some embodiments,the system may receive configuration information that determines whetherthe normalized format is used for storing data in memory, includingconditions for determining when the format is used. For example, thesystem may only use the normalized format if more than half of acolumn's data values can be normalized.

Continuing in block 250, the system converts row data associated withthe selected column into a normalized data representation. For example,the normalized data representation may include a fixed size numericvalue into which the system stores multiple different native data types.For example, the system may store floats, dates, integers, Booleans, andother data types as a 64-bit integer in-memory. The normalized formatallows the system to perform unified processing that is suited tosuperscalar processors on a variety of types of data.

If execution reaches block 260, the system identifies a non-normalizeddata structure for storing row data associated with the selected column.The system may store some rows as normalized and others asnon-normalized, such as where some values fall outside of a range thatthe normalized format can contain. The non-normalized structure mayinclude a traditional data structure used before the normalized formatwas introduced, or any other suitable data structure for describing thecolumn/row data value. Continuing in block 270, the system stores apointer to an instance of the identified non-normalized data structurein a normalized data value. For example, the system may set thenormalized data value to the pointer value, and set an unused bit of thepointer value to indicate that the normalized value points to anotherdata structure. In this way, when examining data values, the system caninitially treat each value similarly.

Continuing in decision block 280, if the system determines that thereare more columns in the accessed data, then the system loops to block220 to select the next column, else the system completes. Although shownserially the system can also be implemented to process all columns ormultiple columns at the same time while making fewer passes through therows of data. After block 280, these steps conclude.

FIG. 3 is a flow diagram that illustrates processing of the datanormalization system to perform an operation on a tabular set of datahaving rows and columns, in one embodiment. Beginning in block 310, thesystem identifies a batch of operations that can be executed in parallelby a superscalar processor. For example, the system may determine thatan operation operates on each element of an array of data, and that theprocessor can handle each element independently. In some cases, thesystem may identify multiple arrays of data that can be part of a batch,such as where elements of two arrays are being added together. Thesystem assembles the batch and passes the batch to a function orcomponent that includes a fast processing path for superscalar-readydata.

Continuing in block 320, the system identifies zero or morenon-normalized rows of data associated with the batch of operations. Thenon-normalized rows may involve additional processing that is lesssuitable for parallel execution. The system may flag the identifiedrows, add them to a separate list, or ignore them in a first pass andprocess the identified rows in a post-processing step or second pass.Continuing in block 330, the system submits the identified batch ofoperations that involve normalized rows of data to the superscalarprocessor for parallel processing. The superscalar processor recognizesdata with few or no data and control flow dependencies and sends thedata to separate execution units for parallel processing. For example,where the data includes elements of an array, the processor may performan operation in parallel on multiple elements of the array at a time. Insome embodiments, the system performs the actions of blocks 320 and 330at the same time to avoid reading the same data twice. Once data is readfrom memory into a CPU register, it is a relatively cheap operation toperform the actual operation and the normalization check.

Continuing in block 340, the system submits the identified batch ofoperations that involve identified non-normalized rows of data forprocessing. The processing of the non-normalized data may involveinstructions that are less suitable for parallel processing, such as oneor more conditional checks for correct handling of complex data types.By handling these rows in a separate way, the system allows those rowsthat can be processed quickly to benefit from the capabilities of thesuperscalar processor. Continuing in block 350, the system reportsresults of performing the batch of operations to a requestor of theoperations. For example, the system may merge results from processing ofthe normalized data rows and the non-normalized data rows and providethe results in a data structure back to a caller or next operation to beexecuted, such as an application that requested a database query. Afterblock 350, these steps conclude.

FIG. 4 is a block diagram that illustrates data values stored using thenormalized representation described herein, in one embodiment. The firstdata value 410 illustrates a common data type with a value that can bestored in the normalized data representation described herein. The leastsignificant bit 460 is zero to indicate that the value is normalizeddata, and the remaining bits 450 store the actual value (e.g., a numberfor a numeric type). The data values are aligned (e.g., on a four-byteboundary), so that the system can safely assume that the lower bits arezeroes. This allows the least significant bit to be reused to indicatewhether data is normalized or not. The second data value 420 illustratesone manner of representing NULL as a separate value from a numeric zero.The data value 420 sets the least significant bit to one to indicate anon-normalized value type, and the remaining bits to zero to indicatethe value for NULL. The third data value 430 illustrates a data type orvalue that could not be represented in the normalized datarepresentation. The least significant bit is set to one to indicate anon-normalized type, and the remaining bits contain a pointer to anotherdata structure 440 that holds the actual value. The other data structure440 may be any conventional data structure used in RDBMS to representthe non-normalized data type.

The data normalization system described herein can process many types ofdata very fast leveraging superscalar processors. Many types of commondata fit within the normalized data representation described herein(e.g., zip codes, two-letter state codes, license plate numbers, and soforth). As one example, consider a database that stores a person'spurchases. If an operation totals all purchases made by a person in amonth, then the majority of the person's purchases (e.g., groceries,gas) fit within the normalized data types. Only very big-ticket items(e.g., a car purchase) might not fit in the normalized representation.For such an operation, the system can use the fast processing path forall of the data but the big-ticket items then follow up with apost-processing step using a potentially slower path to apply theoperation to the outlying data that is not normalized.

In some embodiments, the data normalization system normalizes shortstrings by placing characters directly in the normalized datarepresentation. For example, where each character of a string uses abyte and the normalized data structure includes seven full bytes andalmost an eighth byte (one byte is used for indicating the normalizedtype), then the system can potentially store eight characters of astring in the normalized data representation. For longer strings, thesystem can include a pointer to the string or a pointer to another datastructure that includes the string.

In some embodiments, the data normalization system determines a size ofthe normalized data structure separately for each type of data, so thatsmaller data types or ranges can be represented using less memory. Forexample, if an integer column in a table only contains values that willfit within a single byte, then the system may use a byte-sized datastructure for the normalized representation of data in that column, sothat less memory is allocated for storing the data of that column. Forlarge numbers of rows of data, the saved memory may add up to besubstantial.

From the foregoing, it will be appreciated that specific embodiments ofthe data normalization system have been described herein for purposes ofillustration, but that various modifications may be made withoutdeviating from the spirit and scope of the invention. Accordingly, theinvention is not limited except as by the appended claims.

I/we claim:
 1. A data normalization system for normalizing an in-memoryrepresentation of stored data for faster superscalar processingcomprising: at least one processor and at least one memory device; adata normalization component operating on the at least one processor,the data normalization component configured to: access stored data thatincludes multiple columns, each column having a data type; select acolumn in the accessed data to determine an appropriate in-memoryrepresentation; determine a data type of the selected column; determinewhether row data associated with the selected column can be normalizedbased at least in part on the determined data type of the selectedcolumn; determine a fixed size value for a normalized datarepresentation, wherein the fixed sized value is sized such that it canbe processed by a superscalar processor as a single instruction; andupon determining that the row data can be normalized, convert the rowdata associated with the selected column into the normalized datarepresentation, wherein the normalized data representation is a formatthat allows performing parallel processing of multiple instances of thenormalized data representation using the superscalar processor and thatrepresents multiple data types as the determined fixed size value thatcan be processed by the superscalar processor in the single instruction.2. The system of claim 1 wherein the stored data comprises a file-basedtabular representation of a database, including tables with columns androws of data.
 3. The system of claim 1 wherein select the columncomprises accessing a list of columns and iterating through each columnin the list.
 4. The system of claim 1 wherein determine the data type ofthe selected column comprises accessing metadata in the stored data thatidentifies a type of the column data declared by a database designer. 5.The system of claim 1 wherein determine whether row data can benormalized comprises receiving configuration information that determineswhether the normalized data representation is used for storing data inmemory, including conditions for determining whether the normalized datarepresentation is used.
 6. The system of claim 1 wherein convert the rowdata into the normalized data representation comprises storing the rowdata in a fixed size numeric value into which the system stores multipledifferent native data types.
 7. The system of claim 1 wherein the datanormalization component is further configured to, upon determining thatthe row data cannot be normalized, identify a non-normalized datastructure for storing row data associated with the selected column, andstore a pointer to an instance of the identified non-normalized datastructure in a normalized data value.
 9. The system of claim 7 whereinstore a pointer comprises setting the normalized data value to thepointer value and setting an unused bit of the pointer value to indicatethat the normalized value points to another data structure.
 9. Thesystem of claim 1 wherein the data normalization component is furtherconfigured to store row data values that fall outside of a range thatthe normalized data representation can contain in a non-normalizedstructure.